package com.rp.system.controller;

import java.io.IOException;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.rp.common.utils.RpUtil;
import com.rp.controller.RpController;

@Controller
@RequestMapping("/rp/system/baseData/iconMng/")
public class SysIconController extends RpController {
	
	@ResponseBody
	@RequestMapping("getIconsCssFileContent")
	public String getIconsCssFileContent(){
		String iconsCssFilePath = this.getWebServerDirectory()+"\\rp\\scripts\\miniui\\themes\\icons.css";
		String content = null;
		try {
			content = RpUtil.readFileContent(iconsCssFilePath);
			System.out.println(content);
		} catch (IOException e) {
			e.printStackTrace();
		}
		return content;
	}
	
	@ResponseBody
	@RequestMapping("saveIconsCssFileChange")
	public String saveIconsCssFileChange(String path, String newContent){
		try {
			RpUtil.writeContent2File(path, newContent, false);
		} catch (IOException e) {
			e.printStackTrace();
			return ERROR;
		}
		return SUCCESS;
	}
	
	
}
